
var newer = newer || {};

newer.Page = function() {
	newer.gd = new Object();

	newer.UriHelper.getGlobals(true);
	
	this.bindPopstate();
	
	this.html = new newer.HtmlManager({
		domNode: $("#newer-body")
	});

};

newer.Page.prototype = {

	bindPopstate: function() {
		var self = this;
		$(window).on("popstate", function(event) {
			var prevpstatus = newer.gd.pstatus;
			newer.UriHelper.getGlobals();
			// self.refresh();
			$(".nw-event-listener").trigger('nw-event', {
				type:newer.EventHelper.PAGE_TYPE,
				fromStatus:prevpstatus,
				toStatus:newer.gd.pstatus
			});
		});
	},
		
	refresh: function() {
		if(this.html) {
			this.html.init();
		}
	},
	
	init: function() {
		this.bindPopstate();

	}
};